package com.ruoyi.system.service.impl;

import java.util.Collections;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.AppRedPacketSend;
import com.ruoyi.system.mapper.AppRedPacketSendMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AppTradeRecordMapper;
import com.ruoyi.system.domain.AppTradeRecord;
import com.ruoyi.system.service.IAppTradeRecordService;

/**
 * 流水记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-08-07
 */
@Service
public class AppTradeRecordServiceImpl extends ServiceImpl<AppTradeRecordMapper, AppTradeRecord> implements IAppTradeRecordService {
    @Autowired
    private AppTradeRecordMapper appTradeRecordMapper;

    /**
     * 查询流水记录
     *
     * @param id 流水记录主键
     * @return 流水记录
     */
    @Override
    public AppTradeRecord selectAppTradeRecordById(Long id) {
        return appTradeRecordMapper.selectAppTradeRecordById(id);
    }

    /**
     * 查询流水记录列表
     *
     * @param appTradeRecord 流水记录
     * @return 流水记录
     */
    @Override
    public List<AppTradeRecord> selectAppTradeRecordList(AppTradeRecord appTradeRecord) {
        return appTradeRecordMapper.selectAppTradeRecordList(appTradeRecord);
    }

    /**
     * 新增流水记录
     *
     * @param appTradeRecord 流水记录
     * @return 结果
     */
    @Override
    public int insertAppTradeRecord(AppTradeRecord appTradeRecord) {
        appTradeRecord.setCreateTime(DateUtils.getNowDate());
        return appTradeRecordMapper.insertAppTradeRecord(appTradeRecord);
    }

    /**
     * 修改流水记录
     *
     * @param appTradeRecord 流水记录
     * @return 结果
     */
    @Override
    public int updateAppTradeRecord(AppTradeRecord appTradeRecord) {
        return appTradeRecordMapper.updateAppTradeRecord(appTradeRecord);
    }

    /**
     * 批量删除流水记录
     *
     * @param ids 需要删除的流水记录主键
     * @return 结果
     */
    @Override
    public int deleteAppTradeRecordByIds(Long[] ids) {
        return appTradeRecordMapper.deleteAppTradeRecordByIds(ids);
    }

    /**
     * 删除流水记录信息
     *
     * @param id 流水记录主键
     * @return 结果
     */
    @Override
    public int deleteAppTradeRecordById(Long id) {
        return appTradeRecordMapper.deleteAppTradeRecordById(id);
    }

    @Override
    public List<AppTradeRecord> listByTradeRecord(AppTradeRecord tradeRecord) {
        if (tradeRecord != null) {
            return appTradeRecordMapper.selectAppTradeRecordList(tradeRecord);
        }
        return Collections.emptyList();
    }

    @Override
    public int getCountChongzhi() {
        return appTradeRecordMapper.getCountChongzhi();
    }

    @Override
    public int getCountTixian() {
        return appTradeRecordMapper.getCountTixian();
    }
}
